home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / PARSFNM.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  675 b   |  21 lines

  1. /* PARSFNM.C --- p. 645 */
  2. #include <stdio.h>
  3. #include <dos.h>
  4. main()
  5. {
  6.     char input[80], *rest;
  7.     int option;                /* Option for parsfnm     */
  8.     struct fcb fcb;                /* File Control Block, FCB */
  9.     printf("Enter string containing file name to be"
  10.     "parsed\n(for example, A:MYFILE.DAT):");
  11.     gets(input);
  12.                 /* Parse file name using 'pardfnm' and FCB */
  13.     option = 1;            /* means skip leading separators */
  14.     rest = parsfnm(input, &fcb, option);
  15.                 /* Print results from the fcb structure */
  16.     printf(    "Drive number:     %d\n"
  17.             "File name:     %s\n"
  18.             "Extension:        %s\n", fcb.fcb_drive,
  19.             fcb.fcb_name, fcb.fcb_ext);
  20.     printf("Rest of the input line = %s\n", rest);
  21. }